<template>
  <div>
    <h3>你的课程：</h3>
    <span v-for="item in courseList">
            <el-button style="margin-left: 20px" type="primary" @click="toCourseDiv(item.courseId)" >{{item.name}}</el-button>
        </span>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  name: "",
  data() {
    return {
      sNo: sessionStorage.getItem('sno'),
      courseList: null,
      comId:'',
    }
  },
  created() {
    var that =this
    axios.get('http://localhost:8080/jas/sport/student/getCourseBySno/'+this.sNo).then(function (resp) {
      console.log(resp.data)
      // console.log(resp.data.courseId)
      that.courseList = resp.data
    })

    axios.get('http://localhost:8080/jas/sport/student/getComidByStudent/'+this.sNo).then(function (resp) {
      console.log(resp.data)
      // console.log(resp.data.courseId)
      that.comId = resp.data
      console.log("CourseType页面的+comid"+resp.data)

    })

  },
  methods:{
    toCourseDiv(courseId){

      console.log("courseId+"+courseId)
      this.$router.push({name:'CourseHomework',params:{courseId:courseId, comId:this.comId}})
      // this.$router.push({name:'CourseHomework',params:{nameFromCourseType:name}})
    }
  }
}
</script>

<style lang="scss" scoped>
</style>